package cn.webestar.scms.user.entity;

import cn.webestar.scms.commons.entity.BasicDO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.Set;

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName(value = "t_role", autoResultMap = true)
@Schema(name = "Role", description = "角色")
public class Role extends BasicDO<Long> {

    @TableField("cid")
    @Schema(description = "cid")
    private Long cid;

    @TableField("name")
    @Schema(description = "名称")
    private String name;

    @TableField("remark")
    @Schema(description = "备注")
    private String remark;

    @Schema(description = "权限资源")
    @TableField(value = "resource_ids", typeHandler = JacksonTypeHandler.class)
    private Set<Long> resourceIds;

    @TableField("creator")
    @Schema(description = "创建人")
    private Long creator;

    @TableField("updater")
    @Schema(description = "更新人")
    private Long updater;

    @TableField("create_time")
    @Schema(description = "创建时间")
    private Date createTime;

    @TableField("update_time")
    @Schema(description = "更新时间")
    private Date updateTime;

    @TableField("is_enable")
    @Schema(description = "是否可用")
    private Boolean isEnable;

}